<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>添加节点</h1>
		<div id="div01">
			<p>内容1</p>
		</div>
		<input id="input1" type="text" />
		<input type="button" onclick="add()" value="添加" />
		<script>
			function add()
			{
				var tmpP =document.createElement("p");
				var txtNode=document.createTextNode(input1.value);
				tmpP.appendChild(txtNode);
				div01.appendChild(tmpP);
			}
		</script>
		
		<h1>删除节点</h1>
		<ul id="ul01">
			<li>内容1<a href="javascript:">删除</a></li>
			<li>内容2<a href="javascript:">删除</a></li>
			<li>内容3<a href="javascript:">删除</a></li>
			<li>内容4<a href="javascript:">删除</a></li>
		</ul>
		<script>
			var aArrs=document.getElementsByTagName("a");
			for(var i in aArrs)
			{
				aArrs[i].onclick=function()
				{
				ul01.removeChild(this.parentElement);
				}
			}
		</script>
	</body>
</html>
